@extends('admin.layouts.index')
@section('title', '用户详情')

@section('content')
<link href="https://res.doyea.cn/assets/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="https://res.doyea.cn/assets/libs/bootstrap-table/bootstrap-table-fixed-columns.min.css" rel="stylesheet">
<script src="https://res.doyea.cn/assets/libs/bootstrap-table/bootstrap-table.min.js"></script>
<script src="https://res.doyea.cn/assets/libs/bootstrap-table/bootstrap-table-fixed-columns.min.js"></script>
<script src="https://res.doyea.cn/assets/libs/bootstrap-table/bootstrap-table-locale-all.min.js"></script>
<link rel="stylesheet" href="/assets/css/links_detial.css?v=2022062009">
<style type="text/css">
    .bootstrap-table .fixed-table-toolbar .bs-bars, .bootstrap-table .fixed-table-toolbar .columns, .bootstrap-table .fixed-table-toolbar .search{
        margin-bottom: 0;
    }
    .fixed-table-toolbar{
        width: 100%;
        display: flex;
    }
    .fixed-table-toolbar .bs-bars{
        margin-bottom: 0;
        margin-top: 0;
        flex: 1;
    }
    .columns-right .btn{
        height: 40px;
        line-height: 40px;
        background-color: #000000;
        padding: 0 10px;
        font-size: 20px;
    }
</style>
<div class="row">
    <div class="col-md-4">
        <div class="card">
            <div class="bg-soft" style="height: 100px; background-color: rgba(85,110,230,.25)!important;">
                <div class="row">
                    <div class="col-md-12">
                        <div class="text-primary p-3 users-profile-bakimg">
                            <h5 class="text-primary" style="height:35px;line-height: 35px; margin: 0px;padding: 0px;font-size: 18px;">欢迎回来 !</h5>
                            <p style="overflow:hidden;text-overflow: ellipsis;white-space: nowrap;">您已经注册天天外链 {{ round((time() - strtotime($users->created_at))/86400,0) }} 天</p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="card-body">
                <div class="row" style="margin-bottom:15px;">
                    <div class="col-md-4">
                        <div class="profile-user-avatar">
                            <img src="{{ asset($users->avatar == '' ? '/images/avatar.png': $users->avatar) }}" class="img-thumbnail rounded-circle">
                        </div>
                        <h5 class="users-profile-nike">{{ empty($users->nike) ? "未设置昵称" : $users->nike }}</h5>
                        <p class="users-profile-address">{{ empty($users->address) ? "未设置" : $users->address }}</p>
                    </div>

                    <div class="col-md-8">
                        <div class="row">
                            <div class="col-md-6">
                                @if(!empty($lastorder))
                                @if($lastorder->product_id == 2)
                                <h5 class="users-profile-nike">基础版</h5>
                                @elseif($lastorder->product_id == 3)
                                <h5 class="users-profile-nike">高级版</h5>
                                @else
                                <h5 class="users-profile-nike">旗舰版</h5>
                                @endif
                                @else
                                <h5 class="users-profile-nike">免费会员</h5>
                                @endif
                                <p class="users-profile-address">会员等级</p>
                            </div>
                            <div class="col-md-6">
                                @if(!empty($lastorder))
                                @if($lastorder->end_time <= time())
                                <h5 class="users-profile-nike">已过期</h5>
                                @else
                                <h5 class="users-profile-nike">{{ round(($lastorder->end_time-time())/86400,0) }}天</h5>
                                @endif
                                @else
                                <h5 class="users-profile-nike">-</h5>
                                @endif
                                <p class="users-profile-address">会员到期时间</p>
                            </div>
                        </div>
                        @if(Auth::user()->authority != 3)
                        <a href="{{ url('/admin/prices/products_lists') }}" class="btn btn-primary waves-effect waves-light btn-sm" style="margin-top:15px;">
                            <font>前往开通会员</font> <i class="iconfont icon-weibiaoti34"></i>
                        </a>
                        @else
                        <a href="{{ url('/admin/links_lists/member_orders_add',['id'=>$users->id]) }}" class="btn btn-primary waves-effect waves-light btn-sm" style="margin-top:15px;">
                            <font>给他添加会员</font> <i class="iconfont icon-weibiaoti34"></i>
                        </a>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-8">
        <div class="row">
            <div class="usercenter-card-lists">
                <a href="{{ url('/admin/links_lists/lists') }}" class="card-lists">
                    <i class="iconfont icon-ziyuan"></i>
                    <div class="card-lists-info">
                        <h3>我的推广链接</h3>
                        <h5>{{ $links->total() }}</h5>
                    </div>
                </a>
            </div>
            <div class="usercenter-card-lists">
                <a href="{{ url('/admin/miniapp/miniapp_list') }}" class="card-lists">
                    <i class="iconfont icon-weixinxiaochengxu"></i>
                    <div class="card-lists-info">
                        <h3>我的小程序</h3>
                        <h5>{{ $links_lists_minapps->total() }}</h5>
                    </div>
                </a>
            </div>
            <div class="usercenter-card-lists">
                <a href="{{ url('/admin/users/users_orders_lists') }}" class="card-lists">
                    <i class="iconfont icon-renminbi"></i>
                    <div class="card-lists-info">
                        <h3>累计消费额</h3>
                        <h5>¥{{ $memberorders->where("pay_status",3)->sum("price") }}</h5>
                    </div>
                </a>
            </div>
            <div class="usercenter-card-lists">
                <a href="{{ url('/admin/links_lists/links_lists_add') }}" class="card-lists">
                    <i class="iconfont icon-ziyuan active"></i>
                    <div class="card-lists-info">
                        <h3>创建推广链接</h3>
                        <h5>点击前往免费创建推广链接</h5>
                    </div>
                </a>
            </div>
            <div class="usercenter-card-lists">
                <a href="{{ url('/admin/links_lists/demos') }}" class="card-lists">
                    <i class="iconfont icon-show-fill active"></i>
                    <div class="card-lists-info">
                        <h3>查看演示案例</h3>
                        <h5>视频查看演示案例</h5>
                    </div>
                </a>
            </div>
            <div class="usercenter-card-lists">
                <a href="{{ url('/admin/users/member_orders_invoice') }}" class="card-lists">
                    <i class="iconfont icon-fapiaojine"></i>
                    <div class="card-lists-info">
                        <h3>可申请发票金额</h3>
                        <h5>¥{{ $memberorders->where("pay_status",3)->where("invoice",1)->sum("price") }}</h5>
                    </div>
                </a>
            </div>

            <div class="usercenter-card-help">
                <a class="profile-full-function" href="{{ url('/admin/documents/documents_detail') }}">各平台广告投放方法汇总 (抖音,快手,百度,知乎,短信等)</a>
            </div>
        </div>
    </div>
</div>
<!-- end row -->

<div class="row">
    <div class="col-md-12">
        <div class="m-card">
            <div class="m-navbar-header">
                <ul>
                    <li data="1" class="active">外链列表</li>
                    <li data="2">小程序列表</li>
                    <li data="3">订单记录</li>
                    <li data="4">提现记录</li>
                    @if(Auth::user()->authority == 3)
                    <li data="5">备注</li>
                    <input type="hidden" id="users_id" value="{{ $users->id }}">
                    @else
                    <input type="hidden" id="users_id" value="0">
                    @endif
                    <input type="hidden" id="navbar_num" value="1">
                    <li data="6">账号详情</li>
                    <li data="7">推广邀请</li>
                </ul>
            </div>
            <div class="data-one">
                <div class="search-from" id="toolbar">
                    <div class="m-search-items">
                        <div class="m-search-item">
                            <input type="text" id="link_title" placeholder="请输入链接名称">
                        </div>
                        <div class="m-search-item">
                            <button class="button" onclick="linksReload();">搜索</button>
                        </div>
                        <div class="m-search-handle">
                            @if(Auth::user()->authority == 3)
                            <a class="button" style="margin:0 10px 0 0;" href="/admin/links_lists/links_lists_add?users_id={{ $users->id }}"><i class="bx bx-plus-circle"></i>给他添加外链</a>
                            @else
                            <a class="button" style="margin:0 10px 0 0;" href="/admin/miniapp/minapp_change"><i class="bx bx-transfer-alt"></i>批量切换链接小程序</a>
                            @endif
                        </div>
                    </div>
                </div>
                <table id="links-lists" data-locale="zh-CN" data-toggle="table" data-toolbar="#toolbar" data-ajax="linksLists" data-search="false" data-side-pagination="server" data-pagination="true" data-pagination-pre-text="上一页" data-pagination-next-text="下一页" data-page-list="[10, 25, 50]" data-page-size="15" data-fixed-columns="true" data-fixed-number="1" data-fixed-right-number="1" data-switchable="true" class="table table-bordered table-nowrap" data-loading-template="loadingTemplate" data-show-refresh="true" data-icons="icons" data-show-fullscreen="true">
                    <thead>
                        <tr>
                            <th data-field="title">标题</th>
                            <th data-field="name">小程序名称</th>
                            <th data-field="platfrom_type">类型</th>
                            <th data-field="disable">状态</th>
                            <th data-field="limit_status">访问限制</th>
                            <th data-field="left_pv">剩余访问量</th>
                            <th data-field="method">操作</th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div class="data-two" style="display: none;">
                <input type="hidden" id="cangetmini" value="0">
                <div class="search-from" id="toolbar-mini">
                    <div class="m-search-items">
                        <div class="m-search-item">
                            <input type="text" id="mini_name" placeholder="请输入小程序名称">
                        </div>
                        <div class="m-search-item">
                            <button class="button" onclick="miniReload();">搜索</button>
                        </div>
                    </div>
                </div>
                <table id="mini-lists" data-locale="zh-CN" data-toggle="table" data-toolbar="#toolbar-mini" data-ajax="miniLists" data-search="false" data-side-pagination="server" data-pagination="true" data-pagination-pre-text="上一页" data-pagination-next-text="下一页" data-page-list="[10, 25, 50]" data-page-size="15" data-fixed-columns="true" data-fixed-number="1" data-fixed-right-number="1" data-switchable="true" class="table table-bordered table-nowrap" data-loading-template="loadingTemplate" data-show-refresh="true" data-icons="icons" data-show-fullscreen="true">
                    <thead>
                        <tr>
                            <th data-field="name">名称</th>
                            <th data-field="disable">状态</th>
                            @if(Auth::user()->authority == 3)
                            <th data-field="status">类型</th>
                            <th data-field="type">用途</th>
                            @endif
                            <th data-field="appid">APPID</th>
                            <th data-field="created_at">创建时间</th>
                            <th data-field="method">操作</th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div class="data-three" style="display: none;">
                <input type="hidden" id="cangetorder" value="0">
                <div class="search-from" id="toolbar-order">
                    <div class="m-search-items">
                        <div class="m-search-item">
                            <select id="is_invoice">
                                <option value="0" selected>选择是否开票</option>
                                <option value="1">未开票</option>
                                <option value="2">已开票</option>
                             </select>
                        </div>
                        <div class="m-search-item">
                            <button class="button" onclick="orderReload();">搜索</button>
                        </div>
                    </div>
                </div>
                <table id="order-lists" data-locale="zh-CN" data-toggle="table" data-toolbar="#toolbar-order" data-ajax="orderLists" data-search="false" data-side-pagination="server" data-pagination="true" data-pagination-pre-text="上一页" data-pagination-next-text="下一页" data-page-list="[10, 25, 50]" data-page-size="15" data-fixed-columns="true" data-fixed-number="1" data-fixed-right-number="1" data-switchable="true" class="table table-bordered table-nowrap" data-loading-template="loadingTemplate" data-show-refresh="true" data-icons="icons" data-show-fullscreen="true">
                    <thead>
                        <tr>
                            <th data-field="name">名称</th>
                            <th data-field="price">金额</th>
                            <th data-field="pay_status">状态</th>
                            <th data-field="start_time">开始时间</th>
                            <th data-field="end_time">结束时间</th>
                            @if(Auth::user()->authority == 3)
                            <th data-field="method">操作</th>
                            @endif
                        </tr>
                    </thead>
                </table>
            </div>
            <div class="data-four" style="display: none;">
                <input type="hidden" id="cangetwithdrawal" value="0">
                <div class="search-from" id="toolbar-withdrawal">
                    <div class="m-search-items">
                        <div class="m-search-item">
                            <select id="is_status">
                                <option value="0" selected>选择是否提现成功</option>
                                <option value="2">成功</option>
                                <option value="1">未成功</option>
                             </select>
                        </div>
                        <div class="m-search-item">
                            <button class="button" onclick="withdrawalReload();">搜索</button>
                        </div>
                    </div>
                </div>
                <table id="withdrawal-lists" data-locale="zh-CN" data-toggle="table" data-toolbar="#toolbar-withdrawal" data-ajax="withdrawalLists" data-search="false" data-side-pagination="server" data-pagination="true" data-pagination-pre-text="上一页" data-pagination-next-text="下一页" data-page-list="[10, 25, 50]" data-page-size="15" data-fixed-columns="true" data-fixed-number="1" data-fixed-right-number="1" data-switchable="true" class="table table-bordered table-nowrap" data-loading-template="loadingTemplate" data-show-refresh="true" data-icons="icons" data-show-fullscreen="true">
                    <thead>
                        <tr>
                            <th data-field="name">支付宝姓名</th>
                            <th data-field="alipay">支付宝账号</th>
                            <th data-field="money">金额</th>
                            <th data-field="status">状态</th>
                            <th data-field="created_at">时间</th>
                        </tr>
                    </thead>
                </table>
            </div>
            @if(Auth::user()->authority == 3)
            <div class="data-five" style="display: none;">
                <input type="hidden" id="cangetnotes" value="0">
                <div class="search-from" id="toolbar-notes">
                    <div class="m-search-items">
                        <div class="m-search-item">
                            <button class="button" onclick="remarkShow();"><i class="bx bx-plus-circle"></i>添加用户备注</button>
                        </div>
                    </div>
                </div>
                <table id="notes-lists" data-locale="zh-CN" data-toggle="table" data-toolbar="#toolbar-notes" data-ajax="notesLists" data-search="false" data-side-pagination="server" data-pagination="true" data-pagination-pre-text="上一页" data-pagination-next-text="下一页" data-page-list="[10, 25, 50]" data-page-size="15" data-fixed-columns="true" data-fixed-number="1" data-fixed-right-number="1" data-switchable="true" class="table table-bordered table-nowrap" data-loading-template="loadingTemplate" data-show-refresh="true" data-icons="icons" data-show-fullscreen="true">
                    <thead>
                        <tr>
                            <th data-field="title">标题</th>
                            <th data-field="describe">内容</th>
                            <th data-field="created_at">备注时间</th>
                        </tr>
                    </thead>
                </table>
            </div>
            @endif
            <div class="data-six" style="display: none;">
                <div class="m-info-list">
                    <label>电话:</label>
                    <div class="links">{{ empty($users->username) ? "未设置" : $users->username }}</div>
                </div>
                <div class="m-info-list">
                    <label>微信:</label>
                    <div class="links">{{ empty($userInfo) ? "未设置" : $userInfo->wechat }}</div>
                </div>
                <div class="m-info-list">
                    <label>邮箱:</label>
                    <div class="links">{{ empty($userInfo) ? "未设置" : $userInfo->email }}</div>
                </div>
                @if(Auth::user()->authority == 3)
                <div class="m-info-list">
                    <label>备注:</label>
                    <div class="links"><font>{!! empty($userInfo) ? "暂未添加备注" : $userInfo->remark !!}</font><a href="{{ url('/admin/users/users_authority',['id'=>$users->id]) }}"><i class="bx bx-edit-alt"></i>修改备注</a></div>
                </div>
                <div class="m-info-list">
                    <label>跟进状态:</label>
                    <div class="links">
                        @if($users->status == 1)
                        <font id="status-tip" class="text-warning">未跟进</font>
                        @elseif($users->status == 2)
                        <font id="status-tip" class="text-info">无法接通</font>
                        @elseif($users->status == 3)
                        <font id="status-tip" class="text-success">有意向</font>
                        @elseif($users->status == 4)
                        <font id="status-tip" class="text-danger">无意向</font>
                        @elseif($users->status == 6)
                        <font id="status-tip" class="text-info">拨打任务已提交</font>
                        @elseif($users->status == 7)
                        <font id="status-tip" class="text-success">电话已拨打</font>
                        @else
                        <font id="status-tip" class="text-warning">待跟进</font>
                        @endif<a href="javascript:;" onclick="statusShow();"><i class="bx bx-edit-alt"></i>更新跟进状态</a></div>
                </div>
                <div class="m-info-list">
                    <label>Token:</label>
                    <div class="links"><p class="text-primary" id="copytoken" data-clipboard-text="{{ encrypt($users->id) }}">点击复制token</p></div>
                </div>
                <div class="m-info-list">
                    <label>百度Access_Token:</label>
                    <div class="links"><p style="width:auto;float: left;" class="text-primary" id="copyaccessToken" data-clipboard-text="https://bab.moreqifu.cn/api/version/1/miniapp/access_token?users_id={{ encrypt($users->id) }}&appid=用户小程序的APPID">点击复制</p></div>
                </div>
                <div class="m-info-list">
                    <label>百度Urlscheme:</label>
                    <div class="links"><p style="width:auto;float: left;" class="text-primary" id="copyurlscheme" data-clipboard-text="https://bab.moreqifu.cn/api/version/1/miniapp/access_urlscheme?users_id={{ encrypt($users->id) }}&appid=用户小程序的APPID&links_id=用户天天外链链接ID">点击复制</p></div>
                </div>
                <div class="m-form-item">
                    <a class="m-form-btn m-mr-1" href="{{ url('/admin/users/users_update',['id'=>$users->id]) }}">
                    前往设置
                    </a>
                    <a class="m-form-btn m-btn-dark" href="{{ url('/admin/users/users_authority',['id'=>$users->id]) }}">
                        权限管理
                    </a>
                </div>
                @else
                <div class="m-form-item">
                    <a class="m-form-btn m-mr-1" href="{{ url('/admin/users/users_update') }}">
                    前往设置
                    </a>
                </div>
                @endif
            </div>
            <div class="data-seven" style="display: none;">
                <input type="hidden" id="cangetinvite" value="0">
                <div class="search-from" id="toolbar-invite">
                    <div class="m-search-items">
                        <div class="m-search-item">
                            <input type="text" id="invite_nike" placeholder="请输入用户昵称或账号">
                        </div>
                        <div class="m-search-item">
                            <button class="button" onclick="inviteReload();">搜索</button>
                        </div>
                        <div class="m-search-handle">
                            <a class="button" style="margin:0 10px 0 0;" href="{{ url('/admin/links_lists/users_agent_lists') }}"><i class="bx bx-plus-circle"></i>前往邀请好友</a>
                        </div>
                    </div>
                </div>
                <table id="invite-lists" data-locale="zh-CN" data-toggle="table" data-toolbar="#toolbar-invite" data-ajax="inviteLists" data-search="false" data-side-pagination="server" data-pagination="true" data-pagination-pre-text="上一页" data-pagination-next-text="下一页" data-page-list="[10, 25, 50]" data-page-size="15" data-fixed-columns="true" data-fixed-number="1" data-fixed-right-number="1" data-switchable="true" class="table table-bordered table-nowrap" data-loading-template="loadingTemplate" data-show-refresh="true" data-icons="icons" data-show-fullscreen="true">
                    <thead>
                        <tr>
                            <th data-field="nike">昵称</th>
                            <th data-field="username">账号</th>
                            <th data-field="product_id">会员等级</th>
                            <th data-field="member_time">会员到期</th>
                            <th data-field="created_at">注册时间</th>
                            <th data-field="method">操作</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
</div>
@if(Auth::user()->authority == 3)
<div class="modal fade" id="remarkModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content modal-self-cotain">
            <div class="modal-self-body">
                <div id="qrcodesImagesMore" style="width:100%;float: left;margin-top: 40px;">
                    <div class="row">
                        <div class="col-lg-12">
                            <label>备注标题:<i class="bx bxs-help-circle ms-1" data-bs-toggle="tooltip" data-bs-placement="top" title="备注标题，备注不会对外展示。"></i></label>
                            <div class="m-form-item">
                                <input type="text" class="m-input" id="remarks_title" maxlength="30" placeholder="请输入30字以内备注标题。">
                            </div>
                        </div>
                        <div class="col-lg-12">
                            <label>备注描述:<i class="bx bxs-help-circle ms-1" data-bs-toggle="tooltip" data-bs-placement="top" title="用于区分辨别不同链接，备注不会对外展示。"></i></label>
                            <div class="m-form-item">
                                <textarea style="height: 8.4rem;" class="m-input" id="remarks_describe" maxlength="255" placeholder="请输入备注内容，如果是图片请填写图片网址"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-self-footer">
                <div class="m-form-item">
                    <button type="button" class="m-form-btn" onclick="remarkssubmit();" id="qrcodesModalButtonUpdate" style="margin-left:0;">立即添加</button>
                    <button type="button" class="m-form-btn m-btn-light" data-bs-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="statusModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">
    <div class="modal-dialog">
        <div class="modal-content modal-self-cotain">
            <div class="modal-self-body">
                <div id="qrcodesImagesMore" style="width:100%;float: left;margin-top: 40px;">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="m-form-item">
                                <label><b>*</b>跟进状态:</label>
                                <select class="m-select" id="genjin-status">
                                    <option value="1" @if($users->status == 1) selected @endif>未跟进</option>
                                    <option value="2" @if($users->status == 2) selected @endif>无法接通</option>
                                    <option value="3" @if($users->status == 3) selected @endif>有意向</option>
                                    <option value="4" @if($users->status == 4) selected @endif>无意向</option>
                                    <option value="5" @if($users->status == 5) selected @endif>待跟进</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-self-footer">
                <div class="m-form-item">
                    <button type="button" style="margin-left: 0" class="m-form-btn" onclick="statusSubmit();">立即更新</button>
                    <button type="button" class="m-form-btn m-btn-light" data-bs-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>
@endif

<script src="https://file.wailian1.cn/admin/js/public/clipboard.min.js"></script>
<script src="/js/public/users-center.min.js?v=202308031201"></script>
<script type="text/javascript">
    $(document).ready(function(){
        var copytoken = new ClipboardJS("#copytoken");
        copytoken.on('success', function(e) {
            mviewToastr("success",'Token复制成功');
        });

        var copyaccessToken = new ClipboardJS("#copyaccessToken");
        copyaccessToken.on('success', function(e) {
            mviewToastr("success",'accessToken获取地址复制成功，替换APPID即可使用！');
        });

        var copyurlscheme = new ClipboardJS("#copyurlscheme");
        copyurlscheme.on('success', function(e) {
            mviewToastr("success",'urlscheme获取地址复制成功，替换APPID即可使用！');
        });
    });
</script>
<script type="text/javascript">
    window.icons = {
        refresh: 'bx bx-sync',
        columns: 'bx bx-list-ul',
        toggleOn: 'bx bx-toggle-right',
        toggleOff: 'bx bx-toggle-left',
        fullscreen: 'bx bx-expand'
    }
</script>

@endsection
